<template>
	<view>
		<uni-list>
			<uni-list-item v-for="item in data" :key="item.Id" :title="item.BankName" :note="item.StoreName" :rightText="item.Totalamount-item.Usedamount + ' / '+item.Totalamount"></uni-list-item>
		</uni-list>
		<!-- 上拉显示更多 -->
		<view  class="" style="padding-bottom: 100rpx;">
			<uniLoadMore :status="Status" :contentText="contentText" :rows="data"></uniLoadMore>
		</view>
	</view>
</template>

<script>
	// 引入加载更多
	import uniLoadMore from '@/components/uni-load-more.vue'
	export default {
		components:{
			uniLoadMore
		},
		data() {
			return {
				// 加载状态
				Status: "loading",
				contentText: {
					contentdown: '',
					contentrefresh: '加载中',
					contentnomore: '没有更多了'
				},
				data:[],
				pagination:{
					 PageIndex: 1,
					  PageRows: 20,
					  SortField: "Id",
					  SortType: "",
					  Search: [
					    {
					      Condition: "CreatorId",
					      Keyword: uni.getStorageSync('userInfo').Id,
					    }
					  ]
				}

			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			// 重置相关参数
			// 加载
			this.Status = "loading"
			this.data = []
			this.pagination.PageIndex = 1
			// 重新获取查询数据
			this.GetDataListByMoreCondition()
			uni.stopPullDownRefresh(); //停止刷新
		},
		onShow() {
			// 获取我的额度
			this.GetDataListByMoreCondition()
			
		},
		methods: {
			GetDataListByMoreCondition(){
				this.Status="loading"
				this.$http('post', '/Base/Base_Quota/GetDataListByMoreCondition',this.pagination).then(res => {
					if (res.Success) {
						// 赋值总条数
						this.Total = res.Total
						if(res.Data.length==0){
							this.Status="noMore"
							return
						}
						if(this.pagination.PageIndex==1){
							this.data=res.Data
							this.pagination.PageIndex += 1
						}else{
							this.data = this.data.concat(res.Data)
							this.pagination.PageIndex += 1
							
						}
						uni.stopPullDownRefresh(); //停止刷新
						if (this.pagination.PageRows * this.pagination.PageIndex > this.Total) {
							// 暂停加载  没有更多了
							this.Status = "noMore"
							return
						}
						
					}else {
						// 停止加载状态
						this.Status = "noMore"
					}
				})
			}

		}
	}
</script>

<style>

</style>